<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.27">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #821017}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color: #345e0d}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px}
span.s1 {color: #0000aa}
span.s2 {color: #000000}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><b>BFEncodeSter<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Ambisonic B format encoder for stereo signals</b></p>
<p class="p2"><br></p>
<p class="p3"><b>BFEncodeSter.ar(l, r, azimuth, width elevation, rho, gain, wComp)</b></p>
<p class="p2"><br></p>
<p class="p3"><b>l</b> - left side of the input signal</p>
<p class="p3">r - right side of the input signal</p>
<p class="p3"><b>azimuth</b> -<span class="Apple-converted-space">  </span>in radians, -pi to pi</p>
<p class="p3"><b>width </b>- in radians, width of stereo image</p>
<p class="p3"><b>elevation</b> -<span class="Apple-converted-space">  </span>in radians, -0.5pi to +0.5pi</p>
<p class="p3"><b>rho</b> - the speaker radius (1 places shound at the radius, &lt;1 within the radius, &gt;1 is outside the radius)</p>
<p class="p3"><span class="Apple-tab-span">	</span>beyond the radius, a distance scaling is applied (no filtering is done).</p>
<p class="p3"><b>gain</b> - a control rate level input.</p>
<p class="p3"><b>wComp</b> - chooses how the W channels is scaled. If 0, a scaler of 0.707 is used. If 1, W is varied according to the scaling of the X, Y and Z channels. 1 is the default.</p>
<p class="p2"><br></p>
<p class="p3">Output channels are in order W,X,Y,Z.</p>
<p class="p3">Because of the way the W component is scaled, it is recommended that you only decode with BFDecode1 and it's methods.</p>
<p class="p2"><br></p>
<p class="p4">s=Server.internal.boot;</p>
<p class="p4">s.scope;</p>
<p class="p5">// You'll only hear the first two channels on a stereo setup.</p>
<p class="p2"><br></p>
<p class="p6"><span class="s1">SynthDef</span><span class="s2">(</span>\testster<span class="s2">, {</span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s1">var</span> w, x, y, z;</p>
<p class="p7"><span class="Apple-tab-span">	</span>#w, x, y, z = <span class="s1">BFEncodeSter</span>.ar(</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s1">PinkNoise</span>.ar(<span class="s1">Decay</span>.ar(<span class="s1">Impulse</span>.ar(2, 0, 0.25))),</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s1">SinOsc</span>.ar(440, 0, <span class="s1">Decay</span>.ar(<span class="s1">Impulse</span>.ar(2, 0.5, 0.25))),</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>MouseY.kr(0, pi), // center position of image</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s1">MouseX</span>.kr(0, pi) // width</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>);</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s1">Out</span>.ar(0, <span class="s1">B2Ster</span>.ar(w, x, y))</p>
<p class="p7"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p8"><span class="Apple-tab-span">	</span></p>
<p class="p7">s.sendMsg(\s_new, \testster, a=s.nextNodeID, 0, 1);</p>
<p class="p8"><span class="Apple-converted-space"> </span></p>
<p class="p7">s.sendMsg(\n_free, a);</p>
</body>
</html>
